import pandas as pd

paths = [
    '/workspace/qanything_local/qanything_kernel/test_data/new_防台防汛0417.csv',
    '/workspace/qanything_local/qanything_kernel/test_data/new_居住证0417.csv',
    '/workspace/qanything_local/qanything_kernel/test_data/new_2_居住证0417.csv'
]

Q, A = [], []
for path in paths:
    df = pd.read_csv(path, encoding='utf-8')
    for i in range(len(df)):
        question = df.iloc[i]['llm_que']
        answer = df.iloc[i]['LLM生成的答案']
        if not pd.isna(answer):
            Q.append(question)
            A.append(answer)

df2 = pd.DataFrame({'问题': Q, '答案': A})

df2.to_excel('/workspace/qanything_local/qanything_kernel/test_data/问答对0417.xlsx', index=False)
